package com.lan.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * pojo基类
 * 2个日期(created updated)，实现序列化
 */
@Data
@Accessors(chain = true)
public abstract class BaseEntity implements Serializable{

    @TableId("id")
    private String id;

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDateTime created;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDateTime updated;

    /**
     * 当前页
     * */
    @TableField(exist = false)
    private Integer page;
    /**
     * 每页条数
     * */
    @TableField(exist = false)
    private Integer limit;
}
